package org.zjvis.datascience.common.dto.kg;

import com.alibaba.fastjson.JSONObject;
import cn.weiguangfu.swagger2.plus.annotation.ApiRequestExclude;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import org.zjvis.datascience.common.dto.BaseDTO;
import org.zjvis.datascience.common.util.DozerUtil;
import org.zjvis.datascience.common.vo.BaseVO;
import org.zjvis.datascience.common.vo.kg.DataPushVO;

import java.time.LocalDateTime;

/**
 * @description 知识图谱数据推送DTO
 * @date 2022-03-28
 */
@Data
@SuperBuilder
@AllArgsConstructor
@NoArgsConstructor
public class DataPushDTO extends BaseDTO {

    private Long id;

    private Long userId;

    private Long projectId;

    @ApiRequestExclude(groups = {BaseVO.Ignore.class})
    @JsonFormat(shape=JsonFormat.Shape.STRING,pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime due;

    private String dataPushInfo;

//    private int active;

    private String expectation;

    private int status;

    private String response;

    private Long kgId;

    private String name;

    public DataPushVO view() {
        DataPushVO vo = DozerUtil.mapper(this, DataPushVO.class);
        vo.setDataPushInfo(JSONObject.parseObject(this.getDataPushInfo()));
        return vo;
    }
}
